package com.hilaver.dzmis.dao;

import java.util.List;

import org.hibernate.Query;

import com.hilaver.dzmis.basicinfo.BiAccessoryOthers;



public class BiAccessoryOthersDAO extends BaseHibernateDAO {
	public List<Integer> getMaxApplicationReferenceIndex() throws Exception{
		String hql = "select max(referenceIndex1) from " + BiAccessoryOthers.class.getName();
		try {
			Query queryObject = getSession().createQuery(hql);
			return queryObject.list();
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
	}
	
	public List<Integer> getMaxAccessoryReferenceIndex(String ctAccessoryType) throws Exception{
		String hql = "select max(referenceIndex2) from " + BiAccessoryOthers.class.getName() + " where ctAccessoryType = ?";
		try {
			Query queryObject = getSession().createQuery(hql);
			queryObject.setParameter(0, ctAccessoryType);
			return queryObject.list();
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
	}
}
